-- Alter script for ParaDM v3.1.x - v.3.2.0
SELECT GETDATE()
GO


-- By Lun Au (2005-02-24)
ALTER TABLE WORKFLOW_SCHEDULE_TRIGGERS ADD START_TIME INT
GO

-- By Lun Au (2005-03-23)
-- Workflow Permission Implementation
ALTER TABLE MTM_WF_STEP_USER_ACTOR ADD PERMISSION NVARCHAR(100)
GO
UPDATE MTM_WF_STEP_USER_ACTOR SET PERMISSION='RMW'
GO

-- By Lun Au (2005-03-29)
-- Fix bug 1564
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=5 WHERE ID = 4000
GO
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=6 WHERE ID = 3000
GO
-- Loopback all branches
ALTER TABLE MTM_WF_STEP_WF_STEP ADD LOOP_BACK_ALL_BRANCH CHAR(1)
GO

-- By Lun Au (2005-04-29)
-- Protected Resources
CREATE TABLE PROTECTED_RESOURCE (
  ID  int NOT NULL,
  URL_PATTERN varchar(255) NOT NULL,
  NAV_MODE varchar(10),
  OP_MODE varchar(10),
  HELPER_CLASS varchar(100) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

CREATE TABLE PROTECTED_OBJECT (
  ID int NOT NULL,
  RESOURCE_ID int NOT NULL,
  OBJECT_VALUE varchar(255),
  PROTECTION varchar(100),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- By Lun Au (2005-04-29)
-- Requested by Jerry
INSERT INTO SYS_PARAMETER VALUES (6066,'dms.myFavorite_enable','true','B','Select true to enable My Favorite feature.','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER VALUES (6067,'dms.myFavorite_folder_name','My Favorite','S','My Favorite default folder name.','A',0,0,getdate(),0,getdate())
GO

-- By Lun Au (2005-05-09)
-- Holiday setup
CREATE TABLE HOLIDAY_RECORD  (
  ID int NOT NULL,
  WORKING_CALENDAR_ID int NOT NULL,
  HOLIDAY_NAME nvarchar(50) NOT NULL,
  HOLIDAY_TYPE int NOT NULL,
  START_DATE datetime NOT NULL,
  END_DATE datetime NOT NULL,
  DESCRIPTION nvarchar(255) NULL,
  REFERENCE_FLAG char(1) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

CREATE TABLE WORKING_CALENDAR  (
  ID int NOT NULL,
  WORKING_CALENDAR_NAME nvarchar(50)  NOT NULL,
  DESCRIPTION   nvarchar(255)   NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

CREATE TABLE MTM_WORKING_CALENDAR_OBJECT  (
  ID int NOT NULL,
  WORKING_CALENDAR_ID int NOT NULL,
  OBJECT_ID int NOT NULL,
  OBJECT_TYPE  char(1)   NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

INSERT INTO SYS_FUNCTION VALUES (1008,'STP_HOLIDAY_RECORD','Holiday Setup',N'假期設定',N'假期设定','1000','/setup/ListHolidayRecord.do',8,'S','RIECD','A',0,getdate(),0,getdate())
GO

-- Multi-form and form enhancement
ALTER TABLE FORM_SUBMISSION ADD TRACK_ID INT
GO
ALTER TABLE FORM_SUBMISSION ADD WORKFLOW_RECORD_ID INT
GO

UPDATE SYS_FUNCTION SET ID= 7007, DISPLAY_SEQ= 7 WHERE ID=7006
GO
UPDATE SYS_FUNCTION SET ID= 7006, DISPLAY_SEQ= 6 WHERE ID=7005
GO
UPDATE SYS_FUNCTION SET ID= 7005, DISPLAY_SEQ= 5 WHERE ID=7004
GO
UPDATE SYS_FUNCTION SET ID= 7004, DISPLAY_SEQ= 4 WHERE ID=7003
GO
INSERT INTO SYS_FUNCTION VALUES (7003,'FMB_TASK','Form Task',N'待遞表單',N'待递表单',7000,'/form/ListFormTask.do',3,'S','R','A',0,getdate(),0,getdate())
GO

CREATE TABLE MTM_WF_STEP_FORM_RECORD (
  ID int NOT NULL,
  WORKFLOW_STEP_ID int NOT NULL,
  FORM_RECORD_ID int NOT NULL,
  FORM_PAGE_ID int ,
  FORM_SECTION_ID int ,
  FORM_ELEMENT_ID int ,
  PERMISSION char(1) NOT NULL,
  MANDATORY char(1) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

CREATE TABLE MTM_WF_PROGRESS_ACCESS_FORM (
  ID int NOT NULL,
  WORKFLOW_PROGRESS_ID int NOT NULL,
  FORM_RECORD_ID int NOT NULL,
  FORM_SUBMISSION_ID int ,
  PROCESSED char(1) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NULL,
  PRIMARY KEY  (ID)
)
GO
--------------------------------------------------------------------------
--- PLEASE EXECUTE /jsp/admin/alter3.1.7_3.1.8.jsp for data conversion ---
--------------------------------------------------------------------------

-- By Lun Au (2005-05-10)
-- Requested By Vera
CREATE TABLE FORM_FILE_ATTACHMENT (
  ID int NOT NULL,
  FORM_DATA_ELEMENT_ID int NOT NULL,
  ATTACHMENT_NAME nvarchar(255),
  ATTACHMENT_TYPE char(1) NOT NULL,
  EXTERNAL_ID nvarchar(30) NOT NULL,
  CONTENT_SIZE int NOT NULL,
  FLOW_TYPE char(1) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- By Lun Au (2005-05-10)
-- Enhancement 1602
INSERT INTO SYS_PARAMETER VALUES (9025,'workflow.allow_to_proceed_next_task_immediately', 'false', 'B', 'Allow user to proceed next task immediately after complete a task', 'A', 0, 0, getdate(),0,getdate())
GO

-- By Lun Au (2005-05-14)
-- Workflow due date setup
ALTER TABLE WORKFLOW_STEP ADD ON_NO_RESPONSE_CALENDAR_ID INT
GO
INSERT INTO WORKING_CALENDAR VALUES (0,'Default Working Calendar','Default Working Calendar','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_TABLE_KEY VALUES ( 'WORKING_CALENDAR', 0)
GO

-- By Lun Au (2005-05-24)
-- Requested by Vera
CREATE TABLE FORM_ROUTING_RULE (
  ID int NOT NULL,
  FORM_RECORD_ID int NOT NULL,
  RULE_NAME nvarchar(255) NOT NULL,
  RULE_TYPE char(1) NOT NULL,
  OPERATION_TYPE char(1) NOT NULL,
  FORM_EQUATION image NOT NULL,
  FORM_OPERATION_EQUATION image NOT NULL,
  TARGET_ELEMENT_ID varchar(100),
  CHECK_RULE varchar(10),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- By Lun Au (2005-05-27)
-- Multiform disable form task menu
UPDATE SYS_FUNCTION SET STATUS= 'I' WHERE ID=7003
GO

-- By Lun Au (2005-05-28)
-- Default working calendar
UPDATE WORKING_CALENDAR SET ID=1
GO
UPDATE SYS_TABLE_KEY SET TABLE_KEY_MAX=1 WHERE TABLE_NAME='WORKING_CALENDAR'
GO

-- By Lun Au (2005-06-14)
-- Temporarily only have RW permission
UPDATE MTM_WF_STEP_USER_ACTOR SET PERMISSION='RW'
GO

-- By Lun Au (2005-06-21)
-- Workflow's automatic parameters
CREATE TABLE WORKFLOW_STEP_PARAMETER_VALUE (
  ID int NOT NULL,
  WORKFLOW_STEP_ID int NOT NULL,
  PARAMETER_NAME nvarchar(255) NOT NULL,
  PARAMETER_VALUE nvarchar(255),
  PARAMETER_TYPE char(1) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- Trigger sub workflow
INSERT INTO WORKFLOW_ACTION VALUES (25,'workflow.action.label.trigger_subworkflow_auto_task', NULL, 'com.dcivision.workflow.action.TriggerSubWorkflow', 'A', 0, 0,getdate(),0,getdate())
GO

-- By Lun Au (2005-06-30)
-- Workflow stages and report
CREATE TABLE WORKFLOW_STAGE (
  ID INT NOT NULL,
  WORKFLOW_RECORD_ID INT NOT NULL,
  STAGE_NAME NVARCHAR(60) NOT NULL,
  DURATION INT,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID),
  UNIQUE (WORKFLOW_RECORD_ID, STAGE_NAME)
)
GO

CREATE TABLE MTM_WF_STAGE_WF_STEP (
  ID INT NOT NULL,
  WORKFLOW_STAGE_ID INT NOT NULL,
  WORKFLOW_STEP_ID INT NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY (ID)
)
GO

UPDATE SYS_FUNCTION SET DISPLAY_SEQ=7 WHERE ID=8004
GO
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=8 WHERE ID=8005
GO
INSERT INTO SYS_FUNCTION VALUES (8008,'WFM_REPORT','Report',N'流程報表',N'流程报表',8000,'/workflow/ListWorkflowAnalysisReport.do',6,'S','R','A',0,getdate(),0,getdate())
GO
-- By Lun Au (2005-07-20)
-- Requested by Anson, System parameter default value
ALTER TABLE SYS_PARAMETER ADD PARAMETER_DEFAULT_VALUE nvarchar(200)
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='$RCSfile: alter3.2.0.sql,v $,$Revision: 1.22.2.11 $' WHERE ID=-1
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='UTF-8' WHERE ID=1001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='en_US' WHERE ID=1002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='3' WHERE ID=1003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=1004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dcivision' WHERE ID=1005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dd-MM-yyyy' WHERE ID=1006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='HH:mm' WHERE ID=1007
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dd-MM-yyyy HH:mm' WHERE ID=1008
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='###,###,###,###,##0' WHERE ID=1009
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='###,###,###,###,##0.00' WHERE ID=1010
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=1011
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.user.auth.StandardAuthenticationHandler' WHERE ID=1012
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='0' WHERE ID=1013
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='yyyy-MM-dd HH:mm:ss' WHERE ID=1014
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=1015
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=1016
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='1000' WHERE ID=1017
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='D:/ParaDM/file/Index' WHERE ID=1018
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='\\, /, :, *, ?, \", <, >, |' WHERE ID=1019
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=1020
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=1021
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=1022
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=1023
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=1024
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=1025
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='6' WHERE ID=1026
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=1027
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='DCIVISION ParaDM Systems' WHERE ID=2001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='LayoutLogoDefault.gif' WHERE ID=2002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='LayoutLoginLogoDefault.gif' WHERE ID=2003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=2004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='20' WHERE ID=2005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=2006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='DCIVISION Limited' WHERE ID=2007
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='DCI' WHERE ID=2008
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=2009
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=2010
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=2011
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=2012
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=2013
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=2014
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=2015
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='mail.dcivision.com' WHERE ID=3001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE=NULL WHERE ID=3002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE=NULL WHERE ID=3003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE=NULL WHERE ID=3004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=3005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='ParaDM System Administrator' WHERE ID=3006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='system@dcivision.com' WHERE ID=3007
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='0' WHERE ID=3008
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='Sched1' WHERE ID=4001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='1' WHERE ID=4002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=4003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=4004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='org.quartz.simpl.SimpleThreadPool' WHERE ID=4005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='3' WHERE ID=4006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='4' WHERE ID=4007
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='org.quartz.impl.jdbcjobstore.JobStoreTX' WHERE ID=4008
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='org.quartz.impl.jdbcjobstore.StdJDBCDelegate' WHERE ID=4009
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='EIP_DS' WHERE ID=4010
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='SCHEDULER_' WHERE ID=4011
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='1' WHERE ID=4012
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='3' WHERE ID=4013
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='5' WHERE ID=4014
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=5001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='99999999' WHERE ID=6001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='2' WHERE ID=6002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.dms.core.StandardStorageLocationResolver' WHERE ID=6003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.dms.core.StandardDocumentNameConvertor' WHERE ID=6004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.dms.core.FileSystemContentStoreHandler' WHERE ID=6005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6007
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='ParaDoc Alert Notification' WHERE ID=6008
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=6009
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6010
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='SCAN.NAME_IN_AUTO_GEN' WHERE ID=6011
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='0' WHERE ID=6012
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='SCAN.FOLDER_CREATE_BY_UDFBY_DATE' WHERE ID=6013
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='yyyyMMddHHmmss' WHERE ID=6014
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.dms.client.analyzer.DmsStandardDocumentAnalyzer' WHERE ID=6015
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.framework.StandardAutoLabelGenerator' WHERE ID=6016
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='REFERENCE_NO' WHERE ID=6017
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='ParaDoc invitation notification' WHERE ID=6018
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6019
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='0' WHERE ID=6020
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='0' WHERE ID=6021
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.dms.core.StandardReferenceNoProcessor' WHERE ID=6022
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dd/MM/yy' WHERE ID=6023
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6024
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6025
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6026
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6027
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='0' WHERE ID=6028
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='15' WHERE ID=6029
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-1' WHERE ID=6030
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-1' WHERE ID=6031
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6032
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6033
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dd-MM-yyyy' WHERE ID=6034
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='0' WHERE ID=6035
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=6036
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='15' WHERE ID=6037
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='20' WHERE ID=6038
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='25' WHERE ID=6039
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='30' WHERE ID=6040
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='999' WHERE ID=6041
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6042
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='5' WHERE ID=6043
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6044
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6045
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=6046
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='640M' WHERE ID=6047
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='2M' WHERE ID=6048
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6049
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='60000' WHERE ID=6050
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='60000' WHERE ID=6051
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6052
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='1' WHERE ID=6053
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='15' WHERE ID=6054
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='80' WHERE ID=6055
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=6056
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-1' WHERE ID=6057
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-5' WHERE ID=6058
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-4' WHERE ID=6059
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-3' WHERE ID=6060
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-2' WHERE ID=6061
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='-1' WHERE ID=6062
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='D:/ParaDM/file/ParaDOC/cache/' WHERE ID=6063
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='5' WHERE ID=6064
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='2M' WHERE ID=6065
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6066
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='My Favorite' WHERE ID=6067
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='D:/ParaDM/file/ParaDOC' WHERE ID=6068
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true' WHERE ID=6069
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='LW' WHERE ID=7001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='6' WHERE ID=7002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=7003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='ParaDM Calendar Reminder' WHERE ID=7004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=7005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='2' WHERE ID=7006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='30' WHERE ID=7007
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='D:/ParaDM/file/ParaFORM' WHERE ID=8001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='3' WHERE ID=8002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.workflow.core.WorkflowAttachmentContentHandler' WHERE ID=9001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='D:/ParaDM/file/ParaFLOW' WHERE ID=9002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='5' WHERE ID=9003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='10' WHERE ID=9004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Arrival Notification' WHERE ID=9005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Completion Notification' WHERE ID=9006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Overdue Notification' WHERE ID=9007
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Track Stopped Notification' WHERE ID=9008
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='6' WHERE ID=9009
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='11' WHERE ID=9010
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='1' WHERE ID=9011
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='3,5,7,9' WHERE ID=9012
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='Workflow Delegation Notification' WHERE ID=9013
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='com.dcivision.workflow.core.MailScheduleManager' WHERE ID=9014
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='Workflow Delegation Notification' WHERE ID=9015
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='E,S,' WHERE ID=9016
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='3' WHERE ID=9017
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Before Due Date Notification' WHERE ID=9018
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Pending Notification' WHERE ID=9019
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task In Progress Notification' WHERE ID=9020
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Priority Changed Notification' WHERE ID=9021
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Check Out By User Notification' WHERE ID=9022
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Completed By User Notification' WHERE ID=9023
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=9024
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=9025
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='Document Forum Discussion' WHERE ID=10001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='ldap://localhost:389' WHERE ID=11000
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='cn=root, dc=example, dc=com' WHERE ID=11001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dc=example,dc=com' WHERE ID=11003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dc=example,dc=com' WHERE ID=11004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dn' WHERE ID=11100
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11101
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11102
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11103
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11104
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11105
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11106
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='dn' WHERE ID=11107
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11108
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11109
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11110
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=11111
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=12001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=12002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=12003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=12004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=12005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=12006
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=13001
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=13002
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='/businessobjects/viewrpt.cwr' WHERE ID=13003
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='Administrator' WHERE ID=13004
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='' WHERE ID=13005
GO
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='U2FPDF:0' WHERE ID=13006
GO

-- By Lun Au (2005-07-20)
-- Requested by Roy
ALTER TABLE DMS_DOCUMENT ALTER COLUMN DESCRIPTION NVARCHAR(2000)
GO
ALTER TABLE DMS_VERSION ALTER COLUMN DESCRIPTION NVARCHAR(2000)
GO

-- By Lun Au (2005-07-25)
-- Requested by Charlie
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (1028, 'system.session_timeout', '300', '300', 'I', 'user session timeout', 'A', 0, 0, getdate(),0,getdate())
GO

-- By Lun Au (2005-08-11)
-- Dynamic assign owner permission
ALTER TABLE MTM_WF_DYNAMIC_USER_ACTOR ADD PERMISSION VARCHAR(20)
GO
UPDATE MTM_WF_DYNAMIC_USER_ACTOR SET PERMISSION='RW'
GO

-- By Lun Au (2005-08-29)
-- Requested by Vera
ALTER TABLE FORM_ELEMENT ADD FREEZED CHAR(1)
GO


-- By Lun Au (2005-09-12)
-- Requested by Anson (Event Logger)
CREATE TABLE EVENT_MESSAGE_CODE (
  ID int NOT NULL,
  EVENT_TYPE char(1) NOT NULL,
  MESSAGE_PATTERN nvarchar(255),
  MESSAGE_CODE nvarchar(255),
  ERROR_LABEL_KEY nvarchar(255),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

CREATE TABLE MTM_EVENT_MESSAGE_LOG (
  ID int NOT NULL,
  MESSAGE_CODE_ID int NOT NULL,
  MESSAGE nvarchar(255),
  SOURCE_FUNCTION_CODE nvarchar(30),
  ERROR_DETAIL nvarchar(4000),
  ACTION_TAKER_ID int NOT NULL,
  SERVER_NAME nvarchar(255),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

INSERT INTO SYS_FUNCTION VALUES (2003,'LOG_EVENT_MESSAGE','Event Log',N'事件日誌',N'事件日誌',2000,'/log/ListEventMessge.do',2,'S','RIED','A',0,'2005-09-06 15:30:00',0,'2005-09-06 15:30:00')
GO

INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (1029, 'systemlog.eventlog', '1', '1','I','Event viewer logging level','A',0,0,getdate(),0,getdate())
GO

INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (1030, 'systemlog.eventlog.errorDetail', '0', '0','I','Maximum length to capture exception messages','A',0,0,getdate(),0,getdate())
GO

-- By Lun Au (2005-09-20)
-- Requested by Beyond
ALTER TABLE DMS_DOCUMENT ADD EXT_REF NVARCHAR(255)
GO

-- By Lun Au (2005-09-21)
-- Requested by Vera
ALTER TABLE FORM_DATA_ELEMENT ADD SUBMIT_FLAG NVARCHAR(3)
GO

-- By Lun Au (2005-10-14)
-- Requested by Beyond Qu
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6075, 'dms.enable_emailArchive_auto_tracker', 'false', 'false','B','Enable auto email archive','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6076, 'dms.emailArchive_auto_tracker_time_interval', '5', '5','I','Email archive auto receive interval in minute','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6077, 'dms.emailArchive_auto_tracker_incoming_server_host', '', '','S','Host address to receive incoming email using auto email archive function','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6078, 'dms.emailArchive_auto_tracker_incoming_server_loginname', '', '','S','Login name to receive incoming email using auto email archive function','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6079, 'dms.emailArchive_auto_tracker_incoming_server_password', '', '','S','Password to receive incoming email using auto email archive function','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6080, 'dms.emailArchive_auto_tracker_outgoing_server_host', '', '','S','Host address to receive outgoing email using auto email archive function','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6081, 'dms.emailArchive_auto_tracker_outgoing_server_loginname', '', '','S','Login name to receive outgoing email using auto email archive function','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6082, 'dms.emailArchive_auto_tracker_outgoing_server_password', '', '','S','Password to receive outgoing email using auto email archive function','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6083, 'dms.emailArchive_auto_tracker_mail_servertype', 'pop3', 'pop3','S','Auto email archive server protocol','A',0,0,getdate(),0,getdate())
GO

-- Requested by Tony Chen
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES(14001, 'rules.kb_driver_class', 'org.mandarax.zkb.framework.ZKBDriver_2_0', 'org.mandarax.zkb.framework.ZKBDriver_2_0', 'S', 'ZKB driver', 'A', '0', '0', getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES(14002, 'rules.kb_file_path', 'D:/ParaDM/file/KB', 'D:/ParaDM/file/KB', 'S', 'Knowledge base rule file storage location', 'A', '0', '0', getdate(),0,getdate())
GO
INSERT INTO SYS_FUNCTION VALUES(6013, 'DMS_PUBLIC_RULE_SETUP', 'Public Email Rule', N'公共電郵規則', N'公共电邮规则', '6000', '/dms/ListEmailArchiveRule.do', '14', 'S', 'RIED', 'A', '0', getdate(),0,getdate())
GO
INSERT INTO SYS_FUNCTION VALUES(6014, 'DMS_PRIVATE_RULE_SETUP', 'Private Email Rule', N'私人電郵規則', N'私人电邮规则', '6000', '/dms/ListEmailArchiveRule.do?ruleType=R', '15', 'H', 'RIED', 'A', '0', getdate(),0,getdate())
GO

-- By Lun Au (2005-10-19)
-- Requested by Charlie
CREATE TABLE MTM_FORM_DYNAMIC_VALUE (
  ID int NOT NULL,
  CONDITION_ELEMENT_ID int NOT NULL,
  DYNAMIC_ELEMENT_ID int NOT NULL,
  SQL_STATEMENT nvarchar(255) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- By Lun Au (2005-10-27)
-- Requested by Tony
ALTER TABLE WORKFLOW_QUERY_RECORD ADD WORKFLOW_GROUP_ID INT
GO

-- By Lun Au (2005-11-18)
-- Requested by Ferdinand
CREATE TABLE FORM_VALIDATION_RULE (
  ID int NOT NULL,
  VALIDATION_RULE char(1) NOT NULL,
  REGULAR_EXPR nvarchar(255) NOT NULL,
  LABEL_MSG_KEY nvarchar(255) NOT NULL,
  DESCRIPTION_MSG_KEY nvarchar(255) NULL,
  ERROR_MSG_KEY nvarchar(255) NOT NULL,
  RECORD_STATUS CHAR(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

ALTER TABLE FORM_ELEMENT ADD UNIQUENESS CHAR(1)
GO

INSERT INTO FORM_VALIDATION_RULE VALUES('1', 'S', '/^[a-zA-Z\\s]*$/', 'form.label.validation_alphabet_only', 'Alphabet Only', 'errors.form.label.validate_alphabet', 'A',0,0,getdate(),0,getdate())
GO
INSERT INTO FORM_VALIDATION_RULE VALUES('2', 'S', '/^[\\u4E00-\\u9FA5]*$/', 'form.label.validation_chinese', 'Chinese', 'errors.form.label.validate_chinese', 'A',0,0,getdate(),0,getdate())
GO
INSERT INTO FORM_VALIDATION_RULE VALUES('3', 'I', '/^[-+]?\\d*$/', 'form.label.validation_integer_only', 'Integer Only', 'errors.form.label.validate_integer', 'A',0,0,getdate(),0,getdate())
GO
INSERT INTO FORM_VALIDATION_RULE VALUES('4', 'F', '/^[-+]?\\d*(\\.\\d*)?$/', 'form.label.validation_numeric_only', 'Number Only', 'errors.form.label.validate_number', 'A',0,0,getdate(),0,getdate())
GO
INSERT INTO FORM_VALIDATION_RULE VALUES('5', 'S', '/^(\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*)?$/', 'form.label.validation_email_format', 'Email Format', 'errors.form.label.validate_email', 'A',0,0,getdate(),0,getdate())
GO

-- By Lun Au (2005-11-21)
-- Requested by Ferdinand
CREATE TABLE FORM_REFERENCE_FIELD (
  ID int NOT NULL,
  ELEMENT_ID int NOT NULL,
  START_VALUE int NOT NULL,
  INCREMENT_VALUE int NOT NULL,
  CURRENT_VALUE int NOT NULL,
  LENGTH int NOT NULL,
  CYCLE char(1) NOT NULL,
  LAST_CYCLE_VALUE datetime,
  TOTAL int NOT NULL,
  FORMAT nvarchar(255) NOT NULL,
  DESCRIPTION nvarchar(255),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- By Lun Au (2005-11-28)
-- Requested by Anson, bug 4106
CREATE TABLE DMS_RETENTION_SETUP (
  ID int NOT NULL,
  OBJECT_TYPE char(1) NOT NULL,
  OBJECT_ID int NOT NULL,
  PERIOD_YEAR int,
  PERIOD_MONTH int,
  PERIOD_DAY int,
  OFFSET nvarchar(200),
  PRIORITY char(1) NOT NULL,
  ACTION_NAME nvarchar(20),
  DESCRIPTION nvarchar(255),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- By Lun Au (2006-04-21)
-- Requested by Lee
UPDATE SYS_FUNCTION SET PERMISSION_TYPE= 'RIECDP' WHERE ID=4002
GO

-- By Lun Au (2006-07-06)
-- Requested by Simon
ALTER TABLE MTM_WF_PROGRESS_USER_RECORD ADD OPERATION_PARAMETER NVARCHAR(10)
GO

-- By Lun Au (2006-09-06)
-- Requested by Great Wall, For automatic task hot deploy enhancement
INSERT INTO SYS_FUNCTION VALUES (8010,'WFM_AUTOMATICTASK','Automatic Task',N'自動步驟',N'自动步骤',8000,'/workflow/ListWorkflowAutomaticTask.do',9,'S','RIECD','A',0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES(9033,'workflow.automatic_task_srcdir','D:/ParaDM/file/ParaFlow/AUTOMATICTASK/SRC','D:/ParaDM/file/ParaFlow/AUTOMATICTASK/SRC','S','Automatic Task Java Source Directory','A',0,0,getdate(),0,getdate())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES(9034,'workflow.automatic_task_bindir','D:/ParaDM/file/ParaFlow/AUTOMATICTASK/BIN','D:/ParaDM/file/ParaFlow/AUTOMATICTASK/BIN','S','Automatic Task Compiled Java Classes Directory','A',0,0,getdate(),0,getdate())
GO
UPDATE WORKFLOW_ACTION SET CREATOR_ID=1 WHERE ID>27
GO
INSERT INTO SYS_TABLE_KEY VALUES ('WORKING_ACTION', 27)
GO
UPDATE SYS_TABLE_KEY SET TABLE_KEY_MAX = (SELECT MAX(ID) FROM WORKFLOW_ACTION) WHERE TABLE_NAME = 'WORKFLOW_ACTION'
GO

-- By Lun Au (2006-10-24)
-- Requested by Barbin
INSERT INTO SYS_FUNCTION VALUES (6015,'DMS_EMAIL_AUDIT_TRAIL', 'Email Audit Trail', N'電郵審核追蹤', N'电邮审核追踪', '6000', '/dms/ListEmailAuditTrail.do', '16', 'S', 'RIED', 'A', '0', getdate(),0,getdate())
GO
CREATE TABLE DMS_EMAIL_AUDIT_TRAIL (
  ID int NOT NULL,
  USER_ID int NOT NULL,
  OPERATION nvarchar(100) ,
  EMAIL_FROM nvarchar(225),
  EMAIL_TO nvarchar(2000),
  EMAIL_CC nvarchar(2000),
  EMAIL_BCC nvarchar(225),
  EMAIL_SUBJECT nvarchar(225) ,
  EMAIL_TYPE char(1) NOT NULL,
  SENT_DATE datetime,
  ATTCH_NAME nvarchar(2000),
  ATTCH_SOURCE nvarchar(225),
  ATTCH_COUNT int,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO
CREATE NONCLUSTERED INDEX DEAT_SENT_DATE ON DMS_EMAIL_AUDIT_TRAIL (SENT_DATE)
GO
CREATE NONCLUSTERED INDEX DEAT_EMAIL_SUBJECT ON DMS_EMAIL_AUDIT_TRAIL (EMAIL_SUBJECT)
GO
CREATE NONCLUSTERED INDEX DEAT_USER_ID ON DMS_EMAIL_AUDIT_TRAIL (USER_ID)
GO

-- Requested by Jim Zhou, For EIP-91
ALTER TABLE SYS_USER_DEFINED_INDEX_DETAIL ADD VALUE_SUGGEST char(1)
GO
ALTER TABLE DMS_DEFAULT_PROFILE_SETTING ADD VALUE_SUGGEST_FLAG char(1)
--NOT NULL
GO
UPDATE DMS_DEFAULT_PROFILE_SETTING SET VALUE_SUGGEST_FLAG='Y'
GO

-- Requested by Lee, Lucene enhancement
CREATE TABLE DMS_DOCUMENT_INDEX_CACHE (
  ID int NOT NULL,
  DMS_DOCUMENT_ID int NOT NULL,
  ACTION_MODE nvarchar(3) NOT NULL,
  ACTION_TYPE nvarchar(7),
  SOURCE_DOCUMENT_ID int,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO

-- Requested by Lee, EIP-568
UPDATE SYS_FUNCTION SET PERMISSION_TYPE='RIECDS' WHERE ID='6007'
GO

-- Requested by TC, home page channel refresh threshold
INSERT INTO SYS_PARAMETER (ID,PARAMETER_CODE,PARAMETER_VALUE,PARAMETER_DEFAULT_VALUE,PARAMETER_TYPE,DESCRIPTION,RECORD_STATUS,UPDATE_COUNT,CREATOR_ID,CREATE_DATE,UPDATER_ID,UPDATE_DATE)
VALUES (2017,'display.channel_interval','20000','20000','I','Channel time interval','A',0,0,getdate(),0,getdate())
GO

-- Requested by Great Wall, message management enhancement
ALTER TABLE UPDATE_ALERT_TYPE ADD ALERT_SUBJECT NVARCHAR(255)
GO
INSERT INTO SYS_FUNCTION VALUES (9000,'MSG','Message Management',N'訊息管理',N'讯息管理',0,NULL,4,'S','R','A',0,getdate(),0,getdate())
GO
INSERT INTO SYS_FUNCTION VALUES (9001,'MSG_INBOX','Received Message',N'已收訊息',N'已收讯息',9000,'/ListSystemMessage.do',1,'S','RD','A',0,getdate(),0,getdate())
GO
UPDATE SYS_FUNCTION SET DISPLAY_SEQ=DISPLAY_SEQ+1 WHERE PARENT_ID=0 AND DISPLAY_SEQ > 3
GO

-- By Lun Au (2006-10-31)
-- Requested by Jenny, EIP-237
UPDATE SYS_FUNCTION SET STATUS='I' WHERE ID=8008
GO
UPDATE SETUP_OPTION_WORKFLOW_CATEGORY SET STATUS='I' WHERE ID=11
GO
-- Fix paradoc default inherit permission
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='false', PARAMETER_DEFAULT_VALUE='false' WHERE ID=6074
GO
-- Fix some sys_parameter extra space problem
UPDATE SYS_PARAMETER SET PARAMETER_CODE=LTRIM(RTRIM(PARAMETER_CODE))
GO

-- By Lun Au (2006-11-24)
-- Disable non-standard package features
UPDATE SYS_FUNCTION SET STATUS='I' WHERE ID IN (1008, 8008)
GO

-- By Lun Au (2006-11-29)
-- Disable non-standard package features
UPDATE SYS_FUNCTION SET STATUS='I' WHERE ID IN (5000, 5001, 5002)
GO
-- Invitee picker
CREATE TABLE INVITEE_PICKER_HISTORY (
  ID int NOT NULL,
  ACTOR_ID int NOT NULL,
  ACT_TYPE nvarchar(20),
  OBJECT_TYPE char(1) NOT NULL,
  OBJECT_ID int NOT NULL,
  ACT_DATE datetime NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
)
GO
CREATE NONCLUSTERED INDEX IVH_ACTOR_ID ON INVITEE_PICKER_HISTORY (ACTOR_ID)
GO
CREATE NONCLUSTERED INDEX IVH_ACT_TYPE ON INVITEE_PICKER_HISTORY (ACT_TYPE)
GO
CREATE NONCLUSTERED INDEX IVH_ACT_DATE ON INVITEE_PICKER_HISTORY (ACT_DATE)
GO

-- By Lun Au (2006-11-30)
-- Update quartz scheduler to 1.5.2
CREATE TABLE [dbo].[SCHEDULER_CALENDARS1] (
  [CALENDAR_NAME] [VARCHAR] (80)  NOT NULL ,
  [CALENDAR] [IMAGE] NOT NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_CALENDARS1] SELECT [CALENDAR_NAME],[CALENDAR] FROM [dbo].[SCHEDULER_CALENDARS]
GO

CREATE TABLE [dbo].[SCHEDULER_CRON_TRIGGERS1] (
  [TRIGGER_NAME] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [VARCHAR] (80)  NOT NULL ,
  [CRON_EXPRESSION] [VARCHAR] (80)  NOT NULL ,
  [TIME_ZONE_ID] [VARCHAR] (80)
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_CRON_TRIGGERS1] SELECT * FROM [dbo].[SCHEDULER_CRON_TRIGGERS]
GO

CREATE TABLE [dbo].[SCHEDULER_FIRED_TRIGGERS1] (
  [ENTRY_ID] [VARCHAR] (95)  NOT NULL ,
  [TRIGGER_NAME] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [VARCHAR] (80)  NOT NULL ,
  [IS_VOLATILE] [VARCHAR] (1)  NOT NULL ,
  [INSTANCE_NAME] [VARCHAR] (80)  NOT NULL ,
  [FIRED_TIME] [BIGINT] NOT NULL ,
  [STATE] [VARCHAR] (16)  NOT NULL,
  [JOB_NAME] [VARCHAR] (80)  NULL ,
  [JOB_GROUP] [VARCHAR] (80)  NULL ,
  [IS_STATEFUL] [VARCHAR] (1)  NULL ,
  [REQUESTS_RECOVERY] [VARCHAR] (1)  NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_FIRED_TRIGGERS1]
SELECT [ENTRY_ID],[TRIGGER_NAME],[TRIGGER_GROUP],'0',[INSTANCE_NAME],[FIRED_TIME],
[TRIGGER_STATE],NULL,NULL,NULL,NULL FROM [dbo].[SCHEDULER_FIRED_TRIGGERS]
GO

CREATE TABLE [dbo].[SCHEDULER_JOB_DETAILS1] (
  [JOB_NAME] [VARCHAR] (80)  NOT NULL ,
  [JOB_GROUP] [VARCHAR] (80)  NOT NULL ,
  [DESCRIPTION] [VARCHAR] (120) NULL ,
  [JOB_CLASS_NAME] [VARCHAR] (128)  NOT NULL ,
  [IS_DURABLE] [VARCHAR] (1)  NOT NULL ,
  [IS_VOLATILE] [VARCHAR] (1)  NOT NULL ,
  [IS_STATEFUL] [VARCHAR] (1)  NOT NULL ,
  [REQUESTS_RECOVERY] [VARCHAR] (1)  NOT NULL ,
  [JOB_DATA] [IMAGE] NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_JOB_DETAILS1]
SELECT [JOB_NAME],[JOB_GROUP],[DESCRIPTION],[JOB_CLASS_NAME],[IS_DURABLE],'0',
[IS_STATEFUL], [REQUESTS_RECOVERY],[JOB_DATA] FROM [dbo].[SCHEDULER_JOB_DETAILS]
GO

CREATE TABLE [dbo].[SCHEDULER_JOB_LISTENERS1] (
  [JOB_NAME] [VARCHAR] (80)  NOT NULL ,
  [JOB_GROUP] [VARCHAR] (80)  NOT NULL ,
  [JOB_LISTENER] [VARCHAR] (80)  NOT NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_JOB_LISTENERS1] SELECT * FROM [dbo].[SCHEDULER_JOB_LISTENERS]
GO

CREATE TABLE [dbo].[SCHEDULER_SIMPLE_TRIGGERS1] (
  [TRIGGER_NAME] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [VARCHAR] (80)  NOT NULL ,
  [REPEAT_COUNT] [BIGINT] NOT NULL ,
  [REPEAT_INTERVAL] [BIGINT] NOT NULL ,
  [TIMES_TRIGGERED] [BIGINT] NOT NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_SIMPLE_TRIGGERS1] SELECT * FROM [dbo].[SCHEDULER_SIMPLE_TRIGGERS]
GO

CREATE TABLE [dbo].[SCHEDULER_BLOB_TRIGGERS1] (
  [TRIGGER_NAME] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [VARCHAR] (80)  NOT NULL ,
  [BLOB_DATA] [IMAGE] NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_BLOB_TRIGGERS1] SELECT * FROM [dbo].[SCHEDULER_BLOB_TRIGGERS]
GO

CREATE TABLE [dbo].[SCHEDULER_TRIGGER_LISTENERS1] (
  [TRIGGER_NAME] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_LISTENER] [VARCHAR] (80)  NOT NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_TRIGGER_LISTENERS1] SELECT * FROM [dbo].[SCHEDULER_TRIGGER_LISTENERS]
GO

CREATE TABLE [dbo].[SCHEDULER_TRIGGERS1] (
  [TRIGGER_NAME] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [VARCHAR] (80)  NOT NULL ,
  [JOB_NAME] [VARCHAR] (80)  NOT NULL ,
  [JOB_GROUP] [VARCHAR] (80)  NOT NULL ,
  [IS_VOLATILE] [VARCHAR] (1)  NOT NULL ,
  [DESCRIPTION] [VARCHAR] (120) NULL ,
  [NEXT_FIRE_TIME] [BIGINT] NULL ,
  [PREV_FIRE_TIME] [BIGINT] NULL ,
  [TRIGGER_STATE] [VARCHAR] (16)  NOT NULL ,
  [TRIGGER_TYPE] [VARCHAR] (8)  NOT NULL ,
  [START_TIME] [BIGINT] NOT NULL ,
  [END_TIME] [BIGINT] NULL ,
  [CALENDAR_NAME] [VARCHAR] (80)  NULL ,
  [MISFIRE_INSTR] [SMALLINT] NULL ,
  [JOB_DATA] [IMAGE] NULL
) ON [PRIMARY]
GO
 INSERT INTO [dbo].[SCHEDULER_TRIGGERS1] SELECT
 [TRIGGER_NAME],[TRIGGER_GROUP],[JOB_NAME],[JOB_GROUP],'0',
 [DESCRIPTION],[NEXT_FIRE_TIME],[PREV_FIRE_TIME],[TRIGGER_STATE],[TRIGGER_TYPE],
 [START_TIME],[END_TIME],[CALENDAR_NAME],[MISFIRE_INSTR],NULL FROM [dbo].[SCHEDULER_TRIGGERS]
GO

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SCHEDULER_JOB_LISTENERS_SCHEDULER_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) ALTER TABLE [dbo].[SCHEDULER_JOB_LISTENERS] DROP CONSTRAINT FK_SCHEDULER_JOB_LISTENERS_SCHEDULER_JOB_DETAILS
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SCHEDULER_TRIGGERS_SCHEDULER_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) ALTER TABLE [dbo].[SCHEDULER_TRIGGERS] DROP CONSTRAINT FK_SCHEDULER_TRIGGERS_SCHEDULER_JOB_DETAILS
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SCHEDULER_CRON_TRIGGERS_SCHEDULER_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) ALTER TABLE [dbo].[SCHEDULER_CRON_TRIGGERS] DROP CONSTRAINT FK_SCHEDULER_CRON_TRIGGERS_SCHEDULER_TRIGGERS
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SCHEDULER_SIMPLE_TRIGGERS_SCHEDULER_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) ALTER TABLE [dbo].[SCHEDULER_SIMPLE_TRIGGERS] DROP CONSTRAINT FK_SCHEDULER_SIMPLE_TRIGGERS_SCHEDULER_TRIGGERS
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_SCHEDULER_TRIGGER_LISTENERS_SCHEDULER_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1) ALTER TABLE [dbo].[SCHEDULER_TRIGGER_LISTENERS] DROP CONSTRAINT FK_SCHEDULER_TRIGGER_LISTENERS_SCHEDULER_TRIGGERS
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_CALENDARS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_CALENDARS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_CRON_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_CRON_TRIGGERS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_BLOB_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_BLOB_TRIGGERS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_FIRED_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_FIRED_TRIGGERS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_PAUSED_TRIGGER_GRPS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_PAUSED_TRIGGER_GRPS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_SCHEDULER_STATE]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_SCHEDULER_STATE]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_LOCKS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_LOCKS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_JOB_DETAILS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_JOB_LISTENERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_JOB_LISTENERS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_SIMPLE_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_SIMPLE_TRIGGERS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_TRIGGER_LISTENERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_TRIGGER_LISTENERS]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_TRIGGERS]
GO

CREATE TABLE [dbo].[SCHEDULER_CALENDARS] (
  [CALENDAR_NAME] [VARCHAR] (80)  NOT NULL ,
  [CALENDAR] [IMAGE] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_CRON_TRIGGERS] (
  [TRIGGER_NAME] [NVARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [CRON_EXPRESSION] [NVARCHAR] (80)  NOT NULL ,
  [TIME_ZONE_ID] [NVARCHAR] (80)
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_FIRED_TRIGGERS] (
  [ENTRY_ID] [NVARCHAR] (95)  NOT NULL ,
  [TRIGGER_NAME] [NVARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [IS_VOLATILE] [NVARCHAR] (1)  NOT NULL ,
  [INSTANCE_NAME] [NVARCHAR] (80)  NOT NULL ,
  [FIRED_TIME] [BIGINT] NOT NULL ,
  [STATE] [NVARCHAR] (16)  NOT NULL,
  [JOB_NAME] [NVARCHAR] (80)  NULL ,
  [JOB_GROUP] [NVARCHAR] (80)  NULL ,
  [IS_STATEFUL] [NVARCHAR] (1)  NULL ,
  [REQUESTS_RECOVERY] [NVARCHAR] (1)  NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_PAUSED_TRIGGER_GRPS] (
  [TRIGGER_GROUP] [NVARCHAR] (80)  NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_SCHEDULER_STATE] (
  [INSTANCE_NAME] [NVARCHAR] (80)  NOT NULL ,
  [LAST_CHECKIN_TIME] [BIGINT] NOT NULL ,
  [CHECKIN_INTERVAL] [BIGINT] NOT NULL ,
  [RECOVERER] [NVARCHAR] (80)  NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_LOCKS] (
  [LOCK_NAME] [NVARCHAR] (40)  NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_JOB_DETAILS] (
  [JOB_NAME] [NVARCHAR] (80)  NOT NULL ,
  [JOB_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [DESCRIPTION] [NVARCHAR] (120) NULL ,
  [JOB_CLASS_NAME] [NVARCHAR] (128)  NOT NULL ,
  [IS_DURABLE] [NVARCHAR] (1)  NOT NULL ,
  [IS_VOLATILE] [NVARCHAR] (1)  NOT NULL ,
  [IS_STATEFUL] [NVARCHAR] (1)  NOT NULL ,
  [REQUESTS_RECOVERY] [NVARCHAR] (1)  NOT NULL ,
  [JOB_DATA] [IMAGE] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_JOB_LISTENERS] (
  [JOB_NAME] [NVARCHAR] (80)  NOT NULL ,
  [JOB_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [JOB_LISTENER] [NVARCHAR] (80)  NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_SIMPLE_TRIGGERS] (
  [TRIGGER_NAME] [NVARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [REPEAT_COUNT] [BIGINT] NOT NULL ,
  [REPEAT_INTERVAL] [BIGINT] NOT NULL ,
  [TIMES_TRIGGERED] [BIGINT] NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_BLOB_TRIGGERS] (
  [TRIGGER_NAME] [VARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [VARCHAR] (80)  NOT NULL ,
  [BLOB_DATA] [IMAGE] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_TRIGGER_LISTENERS] (
  [TRIGGER_NAME] [NVARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [TRIGGER_LISTENER] [NVARCHAR] (80)  NOT NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SCHEDULER_TRIGGERS] (
  [TRIGGER_NAME] [NVARCHAR] (80)  NOT NULL ,
  [TRIGGER_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [JOB_NAME] [NVARCHAR] (80)  NOT NULL ,
  [JOB_GROUP] [NVARCHAR] (80)  NOT NULL ,
  [IS_VOLATILE] [NVARCHAR] (1)  NOT NULL ,
  [DESCRIPTION] [NVARCHAR] (120) NULL ,
  [NEXT_FIRE_TIME] [BIGINT] NULL ,
  [PREV_FIRE_TIME] [BIGINT] NULL ,
  [TRIGGER_STATE] [NVARCHAR] (16)  NOT NULL ,
  [TRIGGER_TYPE] [NVARCHAR] (8)  NOT NULL ,
  [START_TIME] [BIGINT] NOT NULL ,
  [END_TIME] [BIGINT] NULL ,
  [CALENDAR_NAME] [NVARCHAR] (80)  NULL ,
  [MISFIRE_INSTR] [SMALLINT] NULL ,
  [JOB_DATA] [IMAGE] NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[SCHEDULER_CALENDARS] SELECT * FROM [dbo].[SCHEDULER_CALENDARS1]
GO
INSERT INTO [dbo].[SCHEDULER_CRON_TRIGGERS] SELECT * FROM [dbo].[SCHEDULER_CRON_TRIGGERS1]
GO
INSERT INTO [dbo].[SCHEDULER_FIRED_TRIGGERS] SELECT * FROM [dbo].[SCHEDULER_FIRED_TRIGGERS1]
GO
INSERT INTO [dbo].[SCHEDULER_JOB_DETAILS] SELECT * FROM [dbo].[SCHEDULER_JOB_DETAILS1]
GO
INSERT INTO [dbo].[SCHEDULER_JOB_LISTENERS] SELECT * FROM [dbo].[SCHEDULER_JOB_LISTENERS1]
GO
INSERT INTO [dbo].[SCHEDULER_SIMPLE_TRIGGERS] SELECT * FROM [dbo].[SCHEDULER_SIMPLE_TRIGGERS1]
GO
INSERT INTO [dbo].[SCHEDULER_BLOB_TRIGGERS] SELECT * FROM [dbo].[SCHEDULER_BLOB_TRIGGERS1]
GO
INSERT INTO [dbo].[SCHEDULER_TRIGGER_LISTENERS] SELECT * FROM [dbo].[SCHEDULER_TRIGGER_LISTENERS1]
GO
INSERT INTO [dbo].[SCHEDULER_TRIGGERS] SELECT * FROM [dbo].[SCHEDULER_TRIGGERS1]
GO

ALTER TABLE [dbo].[SCHEDULER_CALENDARS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_CALENDARS] PRIMARY KEY  CLUSTERED
  (
    [CALENDAR_NAME]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_CRON_TRIGGERS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_CRON_TRIGGERS] PRIMARY KEY  CLUSTERED
  (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_FIRED_TRIGGERS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_FIRED_TRIGGERS] PRIMARY KEY  CLUSTERED
  (
    [ENTRY_ID]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_PAUSED_TRIGGER_GRPS] PRIMARY KEY  CLUSTERED
  (
    [TRIGGER_GROUP]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_SCHEDULER_STATE] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_SCHEDULER_STATE] PRIMARY KEY  CLUSTERED
  (
    [INSTANCE_NAME]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_LOCKS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_LOCKS] PRIMARY KEY  CLUSTERED
  (
    [LOCK_NAME]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_JOB_DETAILS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_JOB_DETAILS] PRIMARY KEY  CLUSTERED
  (
    [JOB_NAME],
    [JOB_GROUP]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_JOB_LISTENERS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_JOB_LISTENERS] PRIMARY KEY  CLUSTERED
  (
    [JOB_NAME],
    [JOB_GROUP],
    [JOB_LISTENER]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_SIMPLE_TRIGGERS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_SIMPLE_TRIGGERS] PRIMARY KEY  CLUSTERED
  (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_TRIGGER_LISTENERS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_TRIGGER_LISTENERS] PRIMARY KEY  CLUSTERED
  (
    [TRIGGER_NAME],
    [TRIGGER_GROUP],
    [TRIGGER_LISTENER]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_TRIGGERS] WITH NOCHECK ADD
  CONSTRAINT [PK_SCHEDULER_TRIGGERS] PRIMARY KEY  CLUSTERED
  (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  )  ON [PRIMARY]
GO

ALTER TABLE [dbo].[SCHEDULER_CRON_TRIGGERS] ADD
  CONSTRAINT [FK_SCHEDULER_CRON_TRIGGERS_SCHEDULER_TRIGGERS] FOREIGN KEY
  (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  ) REFERENCES [dbo].[SCHEDULER_TRIGGERS] (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  ) ON DELETE CASCADE
GO

ALTER TABLE [dbo].[SCHEDULER_JOB_LISTENERS] ADD
  CONSTRAINT [FK_SCHEDULER_JOB_LISTENERS_SCHEDULER_JOB_DETAILS] FOREIGN KEY
  (
    [JOB_NAME],
    [JOB_GROUP]
  ) REFERENCES [dbo].[SCHEDULER_JOB_DETAILS] (
    [JOB_NAME],
    [JOB_GROUP]
  ) ON DELETE CASCADE
GO

ALTER TABLE [dbo].[SCHEDULER_SIMPLE_TRIGGERS] ADD
  CONSTRAINT [FK_SCHEDULER_SIMPLE_TRIGGERS_SCHEDULER_TRIGGERS] FOREIGN KEY
  (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  ) REFERENCES [dbo].[SCHEDULER_TRIGGERS] (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  ) ON DELETE CASCADE
GO

ALTER TABLE [dbo].[SCHEDULER_TRIGGER_LISTENERS] ADD
  CONSTRAINT [FK_SCHEDULER_TRIGGER_LISTENERS_SCHEDULER_TRIGGERS] FOREIGN KEY
  (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  ) REFERENCES [dbo].[SCHEDULER_TRIGGERS] (
    [TRIGGER_NAME],
    [TRIGGER_GROUP]
  ) ON DELETE CASCADE
GO

ALTER TABLE [dbo].[SCHEDULER_TRIGGERS] ADD
  CONSTRAINT [FK_SCHEDULER_TRIGGERS_SCHEDULER_JOB_DETAILS] FOREIGN KEY
  (
    [JOB_NAME],
    [JOB_GROUP]
  ) REFERENCES [dbo].[SCHEDULER_JOB_DETAILS] (
    [JOB_NAME],
    [JOB_GROUP]
  )
GO

INSERT INTO [dbo].[SCHEDULER_LOCKS] VALUES('TRIGGER_ACCESS')
GO
INSERT INTO [dbo].[SCHEDULER_LOCKS] VALUES('JOB_ACCESS')
GO
INSERT INTO [dbo].[SCHEDULER_LOCKS] VALUES('CALENDAR_ACCESS')
GO
INSERT INTO [dbo].[SCHEDULER_LOCKS] VALUES('STATE_ACCESS')
GO
INSERT INTO [dbo].[SCHEDULER_LOCKS] VALUES('MISFIRE_ACCESS')
GO

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_CALENDARS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_CALENDARS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_CRON_TRIGGERS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_CRON_TRIGGERS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_BLOB_TRIGGERS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_BLOB_TRIGGERS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_FIRED_TRIGGERS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_FIRED_TRIGGERS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_PAUSED_TRIGGER_GRPS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_PAUSED_TRIGGER_GRPS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_SCHEDULER_STATE1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_SCHEDULER_STATE1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_LOCKS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_LOCKS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_JOB_DETAILS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_JOB_DETAILS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_JOB_LISTENERS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_JOB_LISTENERS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_SIMPLE_TRIGGERS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_SIMPLE_TRIGGERS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_TRIGGER_LISTENERS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_TRIGGER_LISTENERS1]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[SCHEDULER_TRIGGERS1]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1) DROP TABLE [dbo].[SCHEDULER_TRIGGERS1]
GO

INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (-2, 'system.paradm_version', '3.2.0', '3.2.0', 'S', 'ParaDM Version', 'I', 0, 0, GETDATE(), 0, GETDATE())
GO

-- By Lun Au (2006-12-29)
-- PDF Extractor driver
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6094, 'dms.bizsoft_tiff_viewer','false','false','B','Whether choose new Tiff viewer ActionX.','A',0,0,GETDATE(), 0, GETDATE())
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6095, 'dms.index_document_extractor_pdf','com.dcivision.lucene.extractor.PDFBoxPDFHandler','com.dcivision.lucene.extractor.PDFBoxPDFHandler','S','PDF extractor for Lucene','A',0,0,GETDATE(), 0, GETDATE())
GO

-- By Lun Au (2007-01-16)
-- Temporarily bug fix for EIP-1252
ALTER TABLE DMS_DOCUMENT_DETAIL ALTER COLUMN FIELD_VALUE NVARCHAR(4000)
GO

-- By Lun Au (2007-01-19)
-- EIP-1558
UPDATE FORM_VALIDATION_RULE SET REGULAR_EXPR='/^[a-zA-Z\s]*$/' WHERE ID=1
GO
UPDATE FORM_VALIDATION_RULE SET REGULAR_EXPR='/^[\u4E00-\u9FA5]*$/' WHERE ID=2
GO
UPDATE FORM_VALIDATION_RULE SET REGULAR_EXPR='/^[-+]?\d*$/' WHERE ID=3
GO
UPDATE FORM_VALIDATION_RULE SET REGULAR_EXPR='/^[-+]?\d*(\.\d*)?$/' WHERE ID=4
GO
UPDATE FORM_VALIDATION_RULE SET REGULAR_EXPR='/^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)?$/' WHERE ID=5
GO

-- By Henry Chan (2007-03-13)
-- EIP-1661 Disable email solution related features in ParaDM 3.2.0/3.3.0
UPDATE SYS_FUNCTION SET STATUS='I' WHERE ID=6013
GO
UPDATE SYS_FUNCTION SET STATUS='I' WHERE ID=6014
GO
UPDATE SYS_FUNCTION SET STATUS='I' WHERE ID=6015
GO

-- By Henry Chan (2007-03-13)
-- EIP-2042 Update SYS_PARAMETER "dms.not_inherit_from_parent" to true
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='true', PARAMETER_DEFAULT_VALUE='true' WHERE ID=6074
GO

-- By Henry Chan (2007-03-19)
-- EIP-2051 Disable reference file
UPDATE SYS_FUNCTION SET STATUS= 'I' WHERE ID=6008
GO

-- By Henry Chan (2007-03-20)
-- EIP-1892 Hide the "Event Log" feature in 3.2.0
UPDATE SYS_FUNCTION SET STATUS='I' WHERE ID=2003
GO

-- By Henry Chan (2007-03-22)
-- EIP-1003 Content viewer always show the first/oldest document version
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6097, 'dms.zip_file_size_limit','1024','1024','I','Maximum accumulated documents size (Mb) for zip file export/download','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00')
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6098, 'system.index_default_analyzer','org.apache.lucene.analysis.cjk.CJKAnalyzer','org.apache.lucene.analysis.cjk.CJKAnalyzer','S','The index analyzer class name','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00')
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6099, 'dms.index_run_immediately', 'false', 'false', 'B', 'Whether re-indexing should be run immediately','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00')
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6100, 'dms.index_search_exact_match', 'false' ,'false', 'B', 'Whether exact match should be used when doing index search','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00')
GO
INSERT INTO SYS_PARAMETER (ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE, PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (6101, 'dms.index_document_extractor_xpdf_path','C:/xpdf','C:/xpdf','S','The installation path of XPDF (this value only take effects if pdf extractor is set to com.dcivision.lucene.extractor.XPDFHandler','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00')
GO

-- By Henry Chan (2007-03-23)
-- EIP-1713 can't upload form information and supporting/related document to DMS
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='\, /, :, *, ?, ", <, >, |', PARAMETER_DEFAULT_VALUE='\, /, :, *, ?, ", <, >, |' where PARAMETER_CODE='system.invalid_character'
GO


-- By Henry Chan (2007-03-27)
-- EIP-1063 Wrong word: change "ParaDOC Document Publishment" to "ParaDOC Document Publication"
UPDATE SETUP_OPTION_WORKFLOW_CATEGORY SET WORKFLOW_CATEGORY_NAME='ParaDOC Document Publication (Public Folder)' where WORKFLOW_CATEGORY_NAME='ParaDOC Document Publishment (Public Folder)'
GO
UPDATE SETUP_OPTION_WORKFLOW_CATEGORY SET WORKFLOW_CATEGORY_NAME='ParaDOC Document Publication (Public Folder) - Scanning' where WORKFLOW_CATEGORY_NAME='ParaDOC Document Publishment (Public Folder) - Scanning'
GO
UPDATE SETUP_OPTION_WORKFLOW_CATEGORY SET WORKFLOW_CATEGORY_NAME='ParaDOC Document Publication (Document Profile)' where WORKFLOW_CATEGORY_NAME='ParaDOC Document Publishment (Document Profile)'
GO
UPDATE SETUP_OPTION_WORKFLOW_CATEGORY SET WORKFLOW_CATEGORY_NAME='ParaDOC Document Publication (Document Profile) - Scanning' where WORKFLOW_CATEGORY_NAME='ParaDOC Document Publishment (Document Profile) - Scanning'
GO
UPDATE SETUP_OPTION_WORKFLOW_CATEGORY SET WORKFLOW_CATEGORY_NAME='ParaDOC Paper Document Publication (Document Profile)' where WORKFLOW_CATEGORY_NAME='ParaDOC Paper Document Publishment (Document Profile)'
GO
UPDATE SETUP_OPTION_WORKFLOW_CATEGORY SET WORKFLOW_CATEGORY_NAME='ParaDOC Paper Document Publication (Public Folder)' where WORKFLOW_CATEGORY_NAME='ParaDOC Paper Document Publishment (Public Folder)'
GO

-- By Henry Chan (2007-03-30)
-- EIP-2152 DB Changes - password expiry period + docu name converter + default popup + file rollover limit
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='', PARAMETER_DEFAULT_VALUE='' WHERE ID=1033
GO
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='com.dcivision.dms.core.ShortDocumentNameConvertor', PARAMETER_DEFAULT_VALUE='com.dcivision.dms.core.ShortDocumentNameConvertor' WHERE ID=6004
GO
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='false', PARAMETER_DEFAULT_VALUE='false' WHERE ID=1011
GO
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='50000', PARAMETER_DEFAULT_VALUE='50000' WHERE ID=6073
GO

-- By Henry Chan (2007-05-17)
-- EIP-2316 Remove "My favorite" from Paradoc
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='false', PARAMETER_DEFAULT_VALUE='false', RECORD_STATUS='I' WHERE PARAMETER_CODE='dms.myFavorite_enable'
GO

-- By Henry Chan (2007-05-17)
-- EIP-816 Edit form at form monitoring interface after flow binded with form
UPDATE SYS_FUNCTION SET PERMISSION_TYPE ='RICD' WHERE id=7005
GO

-- @author Bill Liu
-- @date 2007-05-17
-- @issue EIP-2309 Remove "Freeze after filled" function.
ALTER TABLE form_element DROP COLUMN FREEZED
GO

-- @author Bill Liu
-- @date 2007-05-20
-- @issue EIP-2331 Remove Form Element "Reference Number".
DROP TABLE form_reference_field
GO

-- @author Tc Tang
-- @date 2007-05-29
-- @issue EIP-2423 Update Preference page
-- UPDATE THE PREFERENCE TO 2 IF ANY RECORD WHICH COLUMN'S VALUE = 3/OR >2
UPDATE USER_RECORD SET PREFERENCE = 2 WHERE PREFERENCE >2
GO

-- UPDATE THE SYSTEM DEFAULT PERFERENCE FROM P3 to P2
UPDATE SYS_PARAMETER SET PARAMETER_VALUE = '2', PARAMETER_DEFAULT_VALUE='2' WHERE ID='1003'
GO

-- @author TIANQI
-- @date 2007-06-07
-- @issue EIP-2522 UPDATE DOCUMENT PRIORITY
-- UPDATE DOCUMENT PRIORITY IN 31X SO AS TO BE COMPATIBLE WITH 32X. USED FOR DB UPGRADE FROM 31X TO 32X.
UPDATE DMS_DOCUMENT SET PRIORITY = PRIORITY -1
GO

-- @author Lun Au
-- @date 2007-06-13
-- @issue EIP-2688 Hide Message Management from system function menu
UPDATE SYS_FUNCTION SET MENU_TYPE='H' WHERE ID=9000
GO

-- @author Tianqi Wang
-- @date 2007-06-27
-- @issue EIP-2939 System Parameter Datatype Setting Error
UPDATE sys_parameter set parameter_type='S', description='Archive segment size. Ended by character K, M or G.' where parameter_code='dms.archive_segment_size'
GO
UPDATE sys_parameter set parameter_type='S', description='Archive offline viewer size. Ended by character K, M or G.' where parameter_code='dms.archive_offline_viewer_size'
GO
UPDATE sys_parameter set parameter_type='S', description='Archive excel size. Ended by character K, M or G.' where parameter_code='dms.archive_excel_size'
GO

-- @author Ryan Kwan
-- @date 29th June 2007
-- @issue EIP-2468 Revamp authentication logic and tidy up SSO related source code
INSERT INTO SYS_PARAMETER 
(ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE,
PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS,
UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES 
(1034, 'system.authentication.sso_domain_controller_ip', '', '', 'S', 
'Single sign on domain controller IP address', 'A', 0, 0, 
'2000-01-01 00:00:00', 0, '2000-01-01 00:00:00')
GO


-- @author Tianqi Wang
-- @date 2007-07-04
-- @issue EIP-3159 "Reference No" field size is not consistent in different tables
ALTER TABLE DMS_DOCUMENT ALTER COLUMN REFERENCE_NO nvarchar(100)
GO
ALTER TABLE DMS_VERSION ALTER COLUMN REFERENCE_NO nvarchar(100)
GO

-- @author Henry Chan
-- @date 2007-07-16
-- @issue EIP-3339 Turn off Auto-checkout expiry day
update sys_parameter set parameter_value='0' where parameter_code='dms.checkout_expire_day'
GO

-- @author Brook Huang
-- @date 2007-07-18
-- @issue EIP-3172 Current folder root name is missing in breadcrumb
INSERT INTO SYS_PARAMETER 
(ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE,
PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS,
UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES 
(2018, 'display.location.number','2','2','I',
'How many paths to display in location section','A',0,0,getdate(),0,getdate())
GO

-- @author Tianqi Wang
-- @date 2007-07-18
-- @issue EIP-3353 Disable multi-thread support for email sending function
update sys_parameter set PARAMETER_VALUE='0' where PARAMETER_CODE='smtp.max.thread.count'
GO

-- @author tc.tang
-- @date 2007-08-03
-- @issue EIP-3422 Add Ajax_jspTag_Pool_size
INSERT INTO SYS_PARAMETER 
(ID, PARAMETER_CODE, PARAMETER_VALUE, PARAMETER_DEFAULT_VALUE,
PARAMETER_TYPE, DESCRIPTION, RECORD_STATUS,
UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
VALUES (2019, 'display.channel_tag_pool_size','20','20','I',
'Ajax tag pool size','A',0,0,getdate(),0,getdate())
GO

--
-- THIS STATEMENT SHOULD ALWAYS BE PUT AT THE LAST ROW OF THIS FILE
--
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='$RCSfile: alter3.2.0.sql,v $,$Revision: 1.22.2.11 $', UPDATE_COUNT=UPDATE_COUNT+1, UPDATE_DATE=getdate() WHERE ID = -1
GO

-- @author Bill Liu
-- @date 2007-08-12
-- @issue EIP-2374 Fix the db scripts based on the db schema/data comparison result
-- Update Table SYS_FUNCTION Data.

--The function name is 'Staff Management'.
UPDATE SYS_FUNCTION SET STATUS='A' WHERE ID=3000
GO
--The function name is 'Staff Record'.
UPDATE SYS_FUNCTION SET STATUS='A' WHERE ID=3001
GO
--The function name is 'Company Hierarchy'.
UPDATE SYS_FUNCTION SET STATUS='A' WHERE ID=3002
GO

-- @author Bill Liu
-- @date 2007-08-12
-- @issue EIP-2374 Fix the db scripts based on the db schema/data comparison result
-- Update Table SYS_PARAMETER Data.

--The parameter code is 'system.modify_password'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true'  WHERE ID=1031
GO
--The parameter code is 'system.default_max_attempt'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='3'     WHERE ID=1032
GO
--The parameter code is 'display.show_function_menu'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true'  WHERE ID=2016
GO
--The parameter code is 'dms.zip_file_default_encoding'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE=''      WHERE ID=6070
GO
--The parameter code is 'dms.show_no_access_public_folder'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6071
GO
--The parameter code is 'dms.display_no_access_document'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true'  WHERE ID=6072
GO
--The parameter code is 'dms.scan_enable'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6084
GO
--The parameter code is 'dms.scan_folder_creation_bypass_security'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true'  WHERE ID=6085
GO
--The parameter code is 'dms.list.pageAmount'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='5'     WHERE ID=6086
GO
--The parameter code is 'dms.emailArchive.default.host.address'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE=''      WHERE ID=6087
GO
--The parameter code is 'dms.show_download_button'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true'  WHERE ID=6088
GO
--The parameter code is 'dms.clear_cache_file.trigger_time'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='00:00' WHERE ID=6089
GO
--The parameter code is 'dms.clear_cache_file.trigger_interval'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='1'     WHERE ID=6090
GO
--The parameter code is 'dms.show_direct_url'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false' WHERE ID=6091
GO
--The parameter code is 'dms.need_check_tree_permission'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='true'  WHERE ID=6092
GO
--The parameter code is 'dms.emailArchive.lotus.share.folder'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE=''      WHERE ID=6093
GO
--The parameter code is 'workflow.max_priority'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='2'     WHERE ID=9017
GO
--The parameter code is 'workflow.mail_approved_by_user_notification_subject'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Approved By User Notification'     WHERE ID=9026
GO
--The parameter code is 'workflow.mail_rejected_by_user_notification_subject'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Rejected By User Notification'     WHERE ID=9027
GO
--The parameter code is 'workflow.mail_selected_yes_by_user_notification_subject'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Selected Yes By User Notification' WHERE ID=9028
GO
--The parameter code is 'workflow.mail_selected_no_by_user_notification_subject'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Selected No By User Notification'  WHERE ID=9029
GO
--The parameter code is 'workflow.mail_selected_decision_by_user_notification_subject'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='PARA Flow Task Selected {0} By User Notification' WHERE ID=9030
GO
--The parameter code is 'workflow.support_interruption_completed_workflow'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false'     WHERE ID=9031
GO
--The parameter code is 'workflow.interruption_include_autotask'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false'     WHERE ID=9032
GO
--The parameter code is 'contact.enable.internal.users'
UPDATE SYS_PARAMETER SET PARAMETER_DEFAULT_VALUE='false'     WHERE ID=15000
GO

-- @author Bill Liu
-- @date 2007-08-14
-- @issue EIP-2374 Fix the db scripts based on the db schema/data comparison result
-- Create Index For Table SCHEDULER_FIRED_TRIGGERS
CREATE NONCLUSTERED INDEX IDX_SCH_FT_TRIG_NAME ON SCHEDULER_FIRED_TRIGGERS(TRIGGER_NAME)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_TRIG_GROUP ON SCHEDULER_FIRED_TRIGGERS(TRIGGER_GROUP)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_TRIG_NM_GP ON SCHEDULER_FIRED_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_TRIG_VOLATILE ON SCHEDULER_FIRED_TRIGGERS(IS_VOLATILE)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_TRIG_INST_NAME ON SCHEDULER_FIRED_TRIGGERS(INSTANCE_NAME)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_JOB_NAME ON SCHEDULER_FIRED_TRIGGERS(JOB_NAME)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_JOB_GROUP ON SCHEDULER_FIRED_TRIGGERS(JOB_GROUP)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_JOB_STATEFUL ON SCHEDULER_FIRED_TRIGGERS(IS_STATEFUL)
GO
CREATE NONCLUSTERED INDEX IDX_SCH_FT_JOB_REQ_RECOVERY ON SCHEDULER_FIRED_TRIGGERS(REQUESTS_RECOVERY)
GO

--Create Index For Table SCHEDULER_JOB_DETAILS
CREATE NONCLUSTERED INDEX IDX_SCH_J_REQ_RECOVERY ON SCHEDULER_JOB_DETAILS(REQUESTS_RECOVERY)
GO

-- @author Bill Liu
-- @date 2007-08-14
-- @issue EIP-2374 Fix the db scripts based on the db schema/data comparison result
-- Insert new data to table SYS_PARAMETER.
INSERT INTO SYS_PARAMETER VALUES (6096, 'dms.scan_folder_creation_DPF_ID','','I','scan folder creation default Profile ID','A',0,0,getdate(),0,getdate(),'')
GO

-- @author Wiflish Xie
-- @date 2007-08-20
-- @issue EIP-3613 Fail to capture folder path information in audit trail once the document is deleted from recycle bin.
-- add column 'OBJECT_NAME' for log down document/folder name.
ALTER TABLE AUDIT_TRAIL ADD OBJECT_NAME VARCHAR(100) NOT NULL DEFAULT '';
